<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>规则设定 客户调配</title>
<link href="${rc.contextPath}/common/css/common/common.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="${rc.contextPath}/common/js/common.js"></script>
<script type="text/javascript" src="${rc.contextPath}/common/js/thickbox/jquery.js"></script>
<script type="text/javascript" src="${rc.contextPath}/common/js/thickbox/thickbox.js"></script>
<link rel="stylesheet" href="${rc.contextPath}/common/js/zTree/css/zTreeStyle/zTreeStyle.css" type="text/css"/>
<script type="text/javascript" src="${rc.contextPath}/common/js/zTree/js/jquery-1.4.4.min.js"></script>
<script type="text/javascript" src="${rc.contextPath}/common/js/zTree/js/jquery.ztree.core-3.5.js"></script>
<script type="text/javascript" src="${rc.contextPath}/common/js/zTree/js/jquery.ztree.excheck-3.5.js"></script>
<script type="text/javascript" src="${rc.contextPath}/common/js/zTree/js/jquery.ztree.exedit-3.5.js"></script>


<style type="text/css">
.deploy{border:solid 1px gray; width:700px; height:350px;display:none; z-index:101;position:absolute; background-color:#FFFFFF;}
.deploy .title{width:100%;height:20px;line-height:50px; border-top:solid 1px red;background-color:#b60613;top:0px;}
#greyBackGround{background:#000000;width:100%; display:none; z-index:100; top:0px; left:0px; position:absolute;}

.deptTree{border:solid 1px gray; width:700px; height:500px;display:none; z-index:101;position:absolute; background-color:#FFFFFF;}
.deptTree .title{width:100%;height:20px;line-height:50px; border-top:solid 1px red;background-color:#b60613;top:0px;}
#deptTreeBackGround{background:#000000;width:100%; display:none; z-index:100; top:0px; left:0px; position:absolute;}
</style>
<script type="text/javascript" src="${rc.contextPath}/common/js/main.js"></script>
<script type="text/javascript" src="${rc.contextPath}/common/js/ruleSet/customDeploy.js"></script>
<script type="text/javascript">
var zNodes=$deptJson;
</script>
</head>
<body>
<input type="hidden" id="rootPath" value="${rc.contextPath}"/>
<div class="main">
	<div class="position">
		<div class="p_left">当前位置：规则设定> 客户调配</div>
		<div class="p_right">
	    <dl><dt>姓名：</dt><dd>${currentUser.ename}</dd></dl>
	    <dl><dt>登录时间：</dt><dd><span id="nowDate"></span></dd></dl>
	  	</div>
  	</div>
	<div class="topBox">
    	<div class="mesCheck">
      	<div class="title1"><strong>客户调配</strong></div>
   		<div class="box2C">
   		#if($shiro.hasPermission("客户调配条件查询"))
   		<div style="padding-left: 10px;"  class="tableForm tab1"><br/>
   			<form id="queryForm"  action="${rc.contextPath}/ruleSet/customDeploy/getCustomer" method="post">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
      		<input id="pageNow" name="pageNow" type="hidden"/>
      		
      		会员编号:
      		#if(!$customerId)
      			<input id="customerId" name="customerId" type="text" value=""/>
      		#else
      			<input id="customerId" name="customerId" type="text" value="$customerId"/>
      		#end&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
      		联系人:
      		#if(!$contact)
      			<input id="contact" name="contact" type="text" value=""/>
      		#else
      			<input id="contact" name="contact" type="text" value="$contact"/>
      		#end&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
      		手机:
      		#if(!$phone)
      			<input id="phone" name="phone" type="text"/>
      		#else
      			<input id="phone" name="phone" type="text" value="$phone"/>
      		#end&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
      		电子邮箱:
      		#if(!$email)
      		<input id="email" name="email" type="text"/>
      		#else
      		<input id="email" name="email" type="text" value="$email" />
      		#end&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
      		<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
      		所属部门:
      		<input id="queryDeptId" name="queryDeptId" type="hidden" value="$!dept.id"/>
      		<input id="queryTempDeptId" value="$!dept.dname" readonly="readonly"/>
      		<a href="javaScript:queryDeptTree();"><img src="${rc.contextPath}/common/images/search.jpg" alt="" width="15px;" height="15px;" /></a>
      		&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
      		所属人:
      		<select id="queryEmpName" name="empName" style="width: 135px;">
    		  		<option value="">-------请选择-------</option>
    				#foreach( $emp in $empList)
	    				#if($empName==$emp.ename)
	    					<option value="$!emp.ename" selected="selected">$!emp.ename</option>
	    				#else
	    					<option value="$!emp.ename">$!emp.ename</option>
	    				#end	
    				#end
    			</select> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
      		所属区域:
  		    <select id="queryArea" name="area" style="width: 130px;">
  				<option value="">-------请选择-------</option>
  				#foreach( $area in $areaList)
   				#if($areaName==$area.name)
   					<option value="$area.name" selected="selected">$area.name</option>
   				#else
   					<option value="$area.name">$area.name</option>
   				#end
  				#end
  			</select>
      		&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
      		<input id="queryBtn" type="button" value="查询" />&nbsp;&nbsp;&nbsp;&nbsp;
      		<input id="clean" type="button" value="清空"><br/><br/>
      		</form>
      		</div>
      		#end
      		<div>
      		<table  class="tab2" cellpadding="0" align="center" width="95%" style="text-align: center;">
      			<tr>
      				<th><input id="selectAll" onchange="selectAll()" type="checkbox"></input></th>
      				<th width="250px;">会员编号</th>
      				<th>联系人</th>
      				<th>手机</th>
      				<th>电子邮箱</th>
      				<th>所属人</th>
      				<th>所属区域</th>
      				<th>注册时间</th>
      				<th>备注</th>
      				<th>操作</th>
      			</tr>
      			#foreach( $customer in $pageView.records)
      			<tr>
      				<td>
      				#if($customer.isLogQuery==0)
	      				#if(!$customer.approveStatus)
	      					<input id="multiChoice_$customer.ecrId"  type="checkbox"/>
	      				#elseif($customer.approveStatus!=2)
	      					<input id="multiChoice_$customer.ecrId"  type="checkbox"/>
	      				#end
      				#end
      				</td>
      				<td>
	      				#if($customer.cusId)
	      					<a href="#" onclick="goCustomerDetails('$!customer.cusId')" >$!customer.cusId</a>
	      				#end
      				</td>
      				<td>$!customer.cname</td>
      				<td>$!customer.phone</td>
      				<td>$!customer.email</td>
      				<td>$!customer.ename</td>
      				<td>$!customer.areaName</td>
      				<td>$!customer.addTime</td>
      				<td>XXXX</td>
      				<td id="stateLabel">
      				#if(!$customer.approveStatus)
	      				#if($shiro.hasPermission("客户调配设置"))
	      					#if($customer.isLogQuery==0)
	      					<a id="${customer.cusId}stateLabel" href="javaScript:customDeploy('$!customer.ecrId','$!customer.cmaId','$!customer.cusId','$!customer.deptno','$!customer.dname','$!customer.empno','$!customer.ename','$!customer.cname','$!customer.phone','$!customer.email','$!customer.productId','$!customer.productCode')">调配</a>
	      					#end
	      				#end
      				#elseif($customer.approveStatus==2)
						审批中
      				#elseif($customer.approveStatus==1)
      					#if($customer.isLogQuery==0)
      						<a href="javaScript:customDeploy('$!customer.ecrId','$!customer.cmaId','$customer.cusId','$customer.deptno','$!customer.dname','$!customer.empno','$!customer.ename','$!customer.cname','$!customer.phone','$!customer.email','$!customer.productId','$!customer.productCode')">调配</a>
      					#end
      					[通过]
      				#elseif($customer.approveStatus==3)
      					超时流转
      				#else
      					#if($customer.isLogQuery==0)
      						<a href="javaScript:customDeploy('$!customer.ecrId','$!customer.cmaId','$customer.cusId','$customer.deptno','$!customer.dname','$!customer.empno','$!customer.ename','$!customer.cname','$!customer.phone','$!customer.email','$!customer.productId','$!customer.productCode')">调配</a>
      					#end
      					[未通过]
      				#end
      				</td>
      			</tr>
      			#end
      			
      		</table>
      		</div><br/>
	      		#if($shiro.hasPermission("批量调配"))
	      			<input onclick="bathCustomDeploy();" type="button" value="批量调配" style="margin-left: 20px;" />
	      		#end
	      		#if($shiro.hasPermission("全部批量调配"))
	      			<input onclick="bathAllCustomDeploy();" type="button" value="全部批量调配" style="margin-left: 20px;" />
	      		#end
			<!-- #BeginLibraryItem "/Library/page.lbi" -->
			#set($pageNow=$pageView.pageNow)
			#set($pageNext=$pageView.pageNow+1)
			#if($pageView.pageNow==1)
				 #set($pageBack=$pageView.pageNow)
			#else
				 #set($pageBack=$pageView.pageNow - 1)
			#end
		    #set($startRecord=($pageNow*$pageView.pageSize)-$pageView.pageSize+1)
		    #set($endRecord=($pageNow*$pageView.pageSize))
		    <input type="hidden" value="${pageView.pageCount}" id="pageCount"/>
		    <div class="page clearfix">
		      <ul class="le">
		        <li>显示<span>${startRecord}-${endRecord}</span>条</li>
		        <li>共<span>${pageView.rowCount}</span>条</li>
		        <li>共<span>${pageView.pageCount}</span>页</li>
		        <li>第&nbsp;<span>${pageView.pageNow}</span>&nbsp;页</li>
		      </ul>
		      <ul class="ri">
		        <li><a href="javascript:;configPageController('jump')" class="go">&nbsp;</a></li>
		        <li>到
		          <input type="text" class="input" id="pageJump" size="4" />
		          页</li>
		        <li><a href="javascript:configPageController('${pageView.pageCount}')" class="btn">[末页]</a></li>
		        <li><a href="javascript:configPageController('${pageNext}')" class="btn">[下页]</a></li>
		        <li><a href="javascript:configPageController('${pageBack}')" class="btn">[前页]</a></li>
		        <li><a href="javascript:configPageController('1')" class="btn">[首页]</a></li>
		      </ul>
		    </div>
		    <!-- #EndLibraryItem -->
		    	<script>
	//分页
	function configPageController(value) {
		var pageCount=$("#pageCount").val();
		if(value<1){
			value=1;
		}
		if(value=="jump"){
			value=$("#pageJump").val();
		}
		if(parseInt(value)>parseInt(pageCount)){
			value=pageCount;
		}
		if(!$isQuery){
			window.location="${rc.contextPath}/ruleSet/customDeploy/customDeployPage?pageNow="+value;
		}else{
			$("#pageNow").val(value);
			$("#queryForm").submit();
		}	
	}
	</script>

      		<br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/>
      		
			<div id="deploy" class="deploy" style="width: 600px;height: 230px;">
			<form id="deployForm" action="${rc.contextPath}/ruleSet/customDeploy/customDeploy" method="post">
			   	<div class="title"></div>
			   	<div style="margin-left: 20px;">客户调配</div>
			   	<div style="margin-left: 20px;">
				   	<input id="ecrId" name="ecrId" type="hidden" />
				   	<input id="cmaId" name="cmaId" type="hidden" />
				   	<input id="ecrIdStr" name="ecrIdStr" type="hidden" />
				   	
			   		<input id="cusIdStr" name="cusIdStr" type="hidden" />
			   		<input id="cusId" name="cusId" type="hidden" />
			   		<input id="productId" name="productId" type="hidden" />
			   		<input id="productCode" name="productCode" type="hidden" />
			   		<input id="deployCName" name="cName" type="hidden" />
			   		<input id="deployMail" name="email" type="hidden" />
			   		<input id="deployPhone" name="phone" type="hidden" />
			   		<input id="deployCurrentDeptNo" name="currentDeptNo" type="hidden" />
			   		<input id="deployCurrentEmpNo" name="currentEmpNo" type="hidden" />
			   		<input id="deployCurrentDeptName" name="currentDeptName" type="hidden" />
			   		<input id="deployCurrentEmpName" name="currentEmpName" type="hidden" />
			   		<input id="deployDeptName" name="deployDeptName" type="hidden" />
			   		<input id="deployEmpName" name="deployEmpName" type="hidden" />
			   		
					当前所属部门：<label id="deployCurrentDeptNameLabel"></label>	&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
					当前所属人：<label id="deployCurrentEmpNameLabel"></label><br/>
					调配到部门：
<!-- 					<select id="deployDeptId" name="deployDeptId" style="width: 130px;">
					<option value="">---请选择---</option>
					#if($deptList)
					#foreach($dept in $deptList)
					<option value="$dept.id">$dept.dname</option>
					#end
					#end
			  		</select> -->
			  		<input id="deployDeptId" name="deployDeptId" type="hidden" />
			  		<input id="tempDeptId"  type="text" />
			  		<a href="javaScript:displayDeptTree();"><img src="${rc.contextPath}/common/images/search.jpg" alt="" width="15px;" height="15px;" /></a>
			  		&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
			  		所属人：
			  		<select id="deployEmpNo" name="deployEmpNo" style="width: 130px;">
			  			<option value="">---请选择---</option>
			  		</select><br/>
			  		原因：<br/><textarea id="reason" name="reason" rows="5" cols="10" style="width: 450px;height: 30px;"></textarea>
					<br/><br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
					<input id="deployBtnCancel" type="button" value="取消" style="float:right;margin-right:20px;"/>
					<input id="bathDeployBtn" type="button" value="确定" style="display: none;float:right;margin-right:10px;"/>
					<input id="deployBtn" type="button" value="确定" style="float:right;margin-right: 10px;"/>
				</div>   
			</form>
			</div>
			<div id="deptTree" class="deptTree" style="width: 800px;height: 900px;">
				<div class="title"></div><br/>
				<div style="margin-left: 20px;">选择部门
					&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
					&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
					<input id="deptTreeBtnCancel" type="button"  value="取消" style="float: right;margin-right: 10px;"/>
					<input id="deptTreeBtnConfirm" type="button"  value="确定" style="float: right;margin-right: 10px;"/>&nbsp;&nbsp;
					<input id="queryDeptTreeBtnConfirm" type="button"  value="确定" style="float: right;margin-right: 10px;" />&nbsp;&nbsp;
				</div>
				<div style="margin-left: 20px;overflow-x: auto; overflow-y: auto;float: left;" class="zTreeDemoBackground left" >
					<ul id="treeDemo" class="ztree" style="width: 650px;height: 300px;"></ul>
				</div>
			</div>
		</div>
		</div>
	</div>
	<form id="redirectForm" action="${rc.contextPath}/ruleSet/customDeploy/customDeployPage" style="display: none;">
		<input name="pageNow" type="hidden" value="$!pageView.pageNow"></input>
	</form>
</div>
</body>
</html>
